home *** CD-ROM | disk | FTP | other *** search
- Path: rcp6.elan.af.mil!rscernix!danpop
- From: danpop@mail.cern.ch (Dan Pop)
- Newsgroups: comp.lang.c
- Subject: Re: Tradition or what?
- Date: 15 Feb 96 00:56:08 GMT
- Organization: CERN European Lab for Particle Physics
- Message-ID: <danpop.824345768@rscernix>
- References: <1996Feb13.115611.73989@cc.usu.edu>
- NNTP-Posting-Host: ues5.cern.ch
- X-Newsreader: NN version 6.5.0 #7 (NOV)
-
- In <1996Feb13.115611.73989@cc.usu.edu> erik@cc.usu.edu (Erik van Renselaar) writes:
-
- >Can anyone tell me what the use is of returning
- >the same value for the function and one of the
- >output parameters, like it is done in strcpy?
-
- To be able to write obfuscated code like this:
-
- strcat(strcpy(buff, "foo"), "bar");
-
- >Why return a string for the function if the
- >result is in its first parameter as well?
-
- Apart from the above, there is no sensible answer. Returning a pointer
- to the terminating null of the destination string would have been
- considerably more useful.
-
- >Is this just tradition or is it actually useful
- >for anything?
-
- Since no sane person would use the return value of strcpy like I showed
- above, it's just tradition.
-
- Dan
- --
- Dan Pop
- CERN, CN Division
- Email: danpop@mail.cern.ch
- Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
-